package day20180912.SampleFactory;

public class TestSampleFactory {
    public static void main(String[] args) {

        //通过简单的逻辑判断创建对象
        Human man  = SampleFactory.makeHuman("Man");

        Human woman = SampleFactory.makeHuman("woman");

        //调用反射的方式创建对象
        Human m = SampleFactory.makePeople(Man.class);
        m.say();

        Human w = SampleFactory.makePeople(Woman.class);
        w.say();

        //通过配置文件的方式
        Human h = SampleFactory.make("man");
        h.say();
    }
}
